const Router = require('koa-router');
const {validator,crpytpassword,userinfoValidator,verifyLogin} = require('../middleware/user.middleware')
const router = new Router({prefix:'/users'});
const {login,register,getinfo,getUserController} = require('../controller/user.controller');
const { auth } = require('../middleware/auth.middleware');

//注册接口
router.post('/register',validator({
  user_name:'string',
  password:'string'
}),userinfoValidator,crpytpassword,register)

//登录接口
router.post('/login',validator({
  user_name:'string',
  password:'string'
}),verifyLogin,login)
//获取个人信息
router.get('/getinfo',auth,getinfo)
router.get("/getUser",auth,getUserController)
module.exports = router
